//
//  HRZAdViewController.m
//  EMarket
//
//  Created by 石头 on 2018/11/27.
//  Copyright © 2018 好日子. All rights reserved.
//

#import "HRZAdViewController.h"

@interface HRZAdViewController ()

@property (nonatomic, strong) UIWebView *webView;

@end

@implementation HRZAdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"广告";
    
    [self.view addSubview:self.webView];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.view addSubview:self.webView];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    self.webView = nil;
}

#pragma mark - ----  Set/Get  ----
- (void)setAdUrl:(NSString *)adUrl {
    _adUrl = adUrl;
}

#pragma mark - ----  Lazy  ----
- (UIWebView *)webView{
    if (!_webView) {
        _webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
        _webView.backgroundColor = [UIColor whiteColor];
        if (!self.adUrl) {
            self.adUrl = @"http://www.baidu.com";
        }
        NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.adUrl]];
        [_webView loadRequest:request];
    }
    return _webView;
}


@end
